//
//  NKListenCategroyController.m
//  NiKi
//
//  Created by qiang chen on 16/6/21.
//  Copyright © 2016年 qiang chen. All rights reserved.
//

#import "NKListenCategroyController.h"
#import "NKListenCategoryCell.h"
#define kCellMargin 25

@interface NKListenCategroyController ()<UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>{
    
    __weak IBOutlet UICollectionView *_collectionV;
    __weak IBOutlet NSLayoutConstraint *_collectionBottonH;
}

@end

@implementation NKListenCategroyController
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:NO];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [_collectionV registerNib:[UINib nibWithNibName:NSStringFromClass([NKListenCategoryCell class]) bundle:nil] forCellWithReuseIdentifier:listenCategoryCell];
}

- (IBAction)backBtnClick:(UIButton *)sender {
    [UIView transitionFromView:self.view toView:self.parentViewController.view duration:0.5 options:UIViewAnimationOptionTransitionFlipFromBottom completion:^(BOOL finished) {
       
    }];
}

#pragma mark - collectionDelegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 9;
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    CGFloat w = (ScreenW - kCellMargin*2 - 90)/3.f;
    CGFloat h = w+30.f;
    return CGSizeMake(w, h);
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    NKListenCategoryCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:listenCategoryCell forIndexPath:indexPath];
    return cell;
}




@end
